package com.sam4cloud.auth.project.factory;

import com.sam4cloud.auth.project.enums.LoginTypeEnum;
import com.sam4cloud.auth.project.model.vo.LoginUser;
import com.sam4cloud.auth.project.model.dto.LoginDTO;
import com.sam4cloud.auth.project.service.IOauthUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: Sam
 * @Date: 2022-11-28 15:04
 * @Description: 登录工厂(可扩展)
 */
@Component
public class MicroLoginFactory {

    @Autowired
    private IOauthUserService oauthUserService;


    public LoginUser checkLogin(LoginDTO loginDTO) {
        LoginUser loginUser = null;
        LoginTypeEnum loginType = loginDTO.getLoginType();
        if (LoginTypeEnum.ACCOUNT == loginType) {
            loginUser = oauthUserService.checkLogin(loginDTO);
        } else if (LoginTypeEnum.SMS == loginType) {

        }
        return loginUser;
    }

}
